/**
 * 模板字符串
 * author:dengyiping
 * date:2016/07/29
 */
function authorize(user, action) {
  if ( user !="admin" || action != "register") {
    throw new Error(`用户 ${user} 未被授权执行 ${action} 操作`);
  }else{
      console.log(`用户 ${user} 已授权执行 ${action} 操作，确认执行`);
  }
}

//authorize("admin","POST-MAN");
// authorize("dengyp","POST-MAN");
authorize("admin","register");//用户 admin 已授权执行 register 操作，确认执行
authorize("dengyp","register");//Error: 用户 dengyp 未被授权执行 register 操作